<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
  <title>socket.io.js学习</title>
</head>
<body>
<h2>Hello World!</h2>
</body>
<%--使用socket.io官方CDN中的最新版本的socket.io.js--%>
<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>
<script>
  var socket = io.connect('ws://localhost:8887');
  socket.on('news', function (data) {
    console.log(data);
    socket.emit('my other event', { my: 'data' });
  });
</script>
</html>
